<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html>
<html>
<head>
    <title>管理平台</title>
    <jsp:include page="../../include/header.jsp"></jsp:include>
        <style type="text/css">
			table td{
			text-align: center;
			white-space: normal; 
			overflow: hidden;
		    text-overflow: ellipsis;
			}
		 	table th{
			text-align: center;
		 	}
		 	  /*排序 */
			.querySort{
			   position:relative;
			}
			.down{
			   position: absolute;
			   top:12px;
			   display:inline-block;
			   width:10px;
			   height:12px;
			   margin-left: 8px;
			   background: url("${BASE_PATH}/static/images/sprite-arrow.png") 0 61px;
			}
		    .sort .querySort:NTH-OF-TYPE(2) .down{
			    top:-3px;
			    transform: rotateX(180deg);
			}
			.querySort:hover .down{
			   background: url("${BASE_PATH}/static/images/sprite-arrow.png") 0 21px;
			}
			
		  .downSort{
			    position: absolute;
			    top: 3px;
			    left: 3px;
			    width: 18px;
			    height: 24px;
			    opacity: 0;
			    cursor:pointer;
			}
		    .upSort {
			    position: absolute;
			    top: -15px;
			    left: 3px;
			    width: 18px;
			    height: 24px;
			    opacity: 0; 
			    cursor:pointer;
			}
		</style>
</head>
<body>
<div id="wrapper"  class="row">

	        <div class="col-lg-12">
				<h1 class="page-header">登录下载统计</h1>
				<shiro:hasPermission name="auth:authDownload:doExcel">
					  <button onclick="doExcel();"  class="btn btn-success pull-right">导出</button>
					  </shiro:hasPermission>
				<div class="clearfix"></div>
			</div>
            <div class="col-lg-12">
						<div class="text-muted single-line-text pull-left">共 <font color="#428bca" id="dataCount">0</font> 条记录</div>
						
			</div>
			
			<div class="table-responsive panel panel-default">
				<table id="dataTable" class="table table-hover table-bordered " style=" overflow:scroll;word-break:break-all; word-wrap:break-all;">
		            <thead>
		                <tr>			                	
							<th width="100px" style="text-align: center">登陆平台</th>
							<th width="100px" style="text-align: center">登陆人</th>
							<th width="100px" style="text-align: center">账号角色</th>
							<th width="150px" style="text-align: center">所属分公司</th>
							<th width="150px" style="text-align: center">下单时间</th>
							<th width="100px" style="text-align: center">会员信息下载</th>
							<th width="100px" style="text-align: center">订单统计下载</th>
							<th width="100px" style="text-align: center">线下订单统计下载</th>
							<th width="100px" style="text-align: center">会员积分统计下载</th>
							<th width="100px" style="text-align: center">抵现明细下载</th>
		                </tr>			            
		            </thead>
		            <tbody id="dataList"></tbody>
		        </table>
			</div>
        	<div class="col-lg-12">
       			<div class = "pull-right">
        			<div class="text-muted  pull-left" style="margin-top:20px; margin-right:18px;">
						<select id="pageSize" name="pageSize" class="selectpicker" data-width="100" onchange="query()" >
	    					<option value="10" selected = "selected">10条/页</option>
							<option value="15">15条/页</option>
							<option value="20">20条/页</option>
							<option value="50">50条/页</option>
							<option value="100">100条/页</option>
	    				</select>
					</div>
	        		<ul id="dataPagination" class="pagination-sm pull-right"></ul>
	        	</div>
        	</div>
		</div>

<jsp:include page="../../include/javascripts.jsp"></jsp:include>
<!-- 异步加载下一页数据后，用模板渲染 -->
<script type="text/html" id="thumbTpl">
<a href="javascript:void(0)" onclick="Kit.photo('{{thumb}}')" class="center-block thumbnail thumbnail-none-margin width50"><img src="{{thumb}}"></a>
</script>
<script type="text/html" id="dataTpl">
	{{each list as item}}
	<tr id="item{{item.id}}" data-id="{{item.id}}">	
       
		<td style="text-align: center">{{item.logName}}</td>
	    <td style="text-align: center">{{item.name}}</td>		
		<td style="text-align: center">{{item.accountRole}}</td>		
		<td style="text-align: center">{{item.storeName}}</td>
		<td style="text-align: center">{{item.downloadDate}}</td>
		<td style="text-align: center">{{item.memberDownload | flagTransform:0,'否',1,'是'}}</td>
		
        <td style="text-align: center">{{item.orderDownload | flagTransform:0,'否',1,'是'}}</td>

        <td style="text-align: center">{{item.offlineDownload | flagTransform:0,'否',1,'是'}}</td>
		<td style="text-align: center">{{item.integralDownload | flagTransform:0,'否',1,'是'}}</td>
		<td style="text-align: center">{{item.arrivedDownload | flagTransform:0,'否',1,'是'}}</td>
	</tr>
	{{/each}}
</script>

<script type="text/javascript">
var dataPaginator;
  $(query); 
function query(){
	console.log(1);
	var pageSize=$("#pageSize").val();
	 if(dataPaginator){
		dataPaginator.destroy();
	} 
	dataPaginator = Kit.pagination("#dataPagination","${BASE_PATH}/auth/authDownload/page",{pageSize:pageSize},function(result){
		console.log(result.object.logName);
		//设置显示最新的数据数量
		$("#dataCount").html(result.object.totalRow);
		//根据模板渲染数据并填充
		$("#dataList").empty().append(template("dataTpl",result.object));
	});
} 

  function doExcel(){	
	 window.location.href="${BASE_PATH}/auth/authDownload/doExcel";
	}  
	
</script>
</body>
</html>